{  Statement: http://acmp.ru/?main=task&id_task=542
   Verdict: Accepted
}
uses
    SysUtils, Math;

var
    n:longint;

function BinToInt(B:string):Int64;
var i:byte; k:longint;
begin
result:=0;
k:=length(b);
for i:=1 to k do result:=(result shl 1)+(byte(B[i]) and 1);
end;

function IntToBin(n:int64):string;
var t:string; i:longint;
begin
t:='';
while n>0 do begin
      t:=t+inttostr(n mod 2);
      n:=n div 2;
end;
result:='';
for i:=length(t) downto 1 do
    result:=result+t[i];
end;

function reverse(s:string):string;

var
    i,ls,kk:longint;
    t:char;

begin
ls := length(s);
kk := ls shr 1;
for i := 1 to kk do begin
    t := s[i];
    s[i] := s[ls - i + 1];
    s[ls - i + 1] := t;
end;
result := s;
end;

begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
write(bintoint(reverse(inttobin(n))));
end.
